﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace WcfSTS
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class Service1 : IService1
    {
        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }

        public dane_pacjentow GetDanePacjenta(int id_pacjent)
        {
            MGREntities dbContext = new MGREntities();
            dane_pacjentow dp = dbContext.dane_pacjentow.SingleOrDefault(p => p.id_pacjenta == id_pacjent);
            return dp;
        }

        public List<badania> GetBadaniaOgolne(int id_pacjent)
        {
            MGREntities badaniaContext = new MGREntities();
            var query = from b in badaniaContext.badania
                        where b.dane_pacjentow.id_pacjenta == id_pacjent
                        select b;
            return query.ToList();
        }

        public List<badania_krew> GetBadaniaKrwi(int id_pacjent)
        {
            MGREntities badaniaContext = new MGREntities();
            var query = from b in badaniaContext.badania_krew
                        where b.dane_pacjentow.id_pacjenta == id_pacjent
                        select b;
            return query.ToList();
        }

        public List<badania_mocz> GetBadaniaMoczu(int id_pacjent)
        {
            MGREntities badaniaContext = new MGREntities();
            var query = from b in badaniaContext.badania_mocz
                        where b.dane_pacjentow.id_pacjenta == id_pacjent
                        select b;
            return query.ToList();
        }


        public List<wizyta> GetWizyty(int id_pacjent)
        {
            MGREntities wizytyContext = new MGREntities();
            var query = from b in wizytyContext.wizyta
                        where b.dane_pacjentow.id_pacjenta == id_pacjent
                        select b;
            return query.ToList();
        }

    }
}
